<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>module FileTest - RDoc Documentation</title>


<script src="./js/navigation.js" defer></script>
<script src="./js/search.js" defer></script>
<script src="./js/search_index.js" defer></script>
<script src="./js/searcher.js" defer></script>
<script src="./js/darkfish.js" defer></script>

<script src="./js/jquery-3.2.0.min.js"></script>

<script src="./js/vue.min.js"></script>
<script src="./js/js.cookie.min.js"></script>

<link href="./css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="./css/rdoc.css" rel="stylesheet">
<link href="./css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "./";
  var index_rel_prefix = "./";
  var darkModeCsseHref = "./css/rdoc-dm.css"
  var defaultModeCssHref = "./css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="module">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0-preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="./index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="./table_of_contents.html#pages">Pages</a>
    <a href="./table_of_contents.html#classes">Classes</a>
    <a href="./table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-i-blockdev-3F">#blockdev?</a>
    <li ><a href="#method-i-chardev-3F">#chardev?</a>
    <li ><a href="#method-i-directory-3F">#directory?</a>
    <li ><a href="#method-i-empty-3F">#empty?</a>
    <li ><a href="#method-i-executable-3F">#executable?</a>
    <li ><a href="#method-i-executable_real-3F">#executable_real?</a>
    <li ><a href="#method-i-exist-3F">#exist?</a>
    <li ><a href="#method-i-file-3F">#file?</a>
    <li ><a href="#method-i-grpowned-3F">#grpowned?</a>
    <li ><a href="#method-i-identical-3F">#identical?</a>
    <li ><a href="#method-i-owned-3F">#owned?</a>
    <li ><a href="#method-i-pipe-3F">#pipe?</a>
    <li ><a href="#method-i-readable-3F">#readable?</a>
    <li ><a href="#method-i-readable_real-3F">#readable_real?</a>
    <li ><a href="#method-i-setgid-3F">#setgid?</a>
    <li ><a href="#method-i-setuid-3F">#setuid?</a>
    <li ><a href="#method-i-size">#size</a>
    <li ><a href="#method-i-size-3F">#size?</a>
    <li ><a href="#method-i-socket-3F">#socket?</a>
    <li ><a href="#method-i-sticky-3F">#sticky?</a>
    <li ><a href="#method-i-symlink-3F">#symlink?</a>
    <li ><a href="#method-i-world_readable-3F">#world_readable?</a>
    <li ><a href="#method-i-world_writable-3F">#world_writable?</a>
    <li ><a href="#method-i-writable-3F">#writable?</a>
    <li ><a href="#method-i-writable_real-3F">#writable_real?</a>
    <li ><a href="#method-i-zero-3F">#zero?</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="module-FileTest">
    <h1 id="module-FileTest" class="module">
      module FileTest
    </h1>

    <section class="description">
    
<p><a href="FileTest.html"><code>FileTest</code></a> implements file test operations similar to those used in <a href="File/Stat.html"><code>File::Stat</code></a>. It exists as a standalone module, and its methods are also insinuated into the <a href="File.html"><code>File</code></a> class. (Note that this is not done by inclusion: the interpreter cheats).</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">





                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-blockdev-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          blockdev?(filepath) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>filepath</code> points to a block device, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-constant">File</span>.<span class="ruby-identifier">blockdev?</span>(<span class="ruby-string">&#39;/dev/sda1&#39;</span>)       <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">blockdev?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;t.tmp&#39;</span>)) <span class="ruby-comment"># =&gt; false</span>
</pre>

                              <div class="method-source-code" id="blockdev-3F-source">
            <pre>static VALUE
rb_file_blockdev_p(VALUE obj, VALUE fname)
{
#ifndef S_ISBLK
#   ifdef S_IFBLK
#       define S_ISBLK(m) (((m) &amp; S_IFMT) == S_IFBLK)
#   else
#       define S_ISBLK(m) (0)  /* anytime false */
#   endif
#endif

#ifdef S_ISBLK
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    if (S_ISBLK(st.st_mode)) return Qtrue;

#endif
    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-chardev-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          chardev?(filepath) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>filepath</code> points to a character device, <code>false</code> otherwise.</p>

<pre class="ruby"><span class="ruby-constant">File</span>.<span class="ruby-identifier">chardev?</span>(<span class="ruby-identifier">$stdin</span>)     <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">chardev?</span>(<span class="ruby-string">&#39;t.txt&#39;</span>)     <span class="ruby-comment"># =&gt; false</span>
</pre>

                              <div class="method-source-code" id="chardev-3F-source">
            <pre>static VALUE
rb_file_chardev_p(VALUE obj, VALUE fname)
{
#ifndef S_ISCHR
#   define S_ISCHR(m) (((m) &amp; S_IFMT) == S_IFCHR)
#endif

    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    if (S_ISCHR(st.st_mode)) return Qtrue;

    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-directory-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          directory?(path) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>With string <code>object</code> given, returns <code>true</code> if <code>path</code> is a string path leading to a directory, or to a symbolic link to a directory; <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-string">&#39;.&#39;</span>)              <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-string">&#39;foo&#39;</span>)            <span class="ruby-comment"># =&gt; false</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink</span>(<span class="ruby-string">&#39;.&#39;</span>, <span class="ruby-string">&#39;dirlink&#39;</span>)      <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-string">&#39;dirlink&#39;</span>)        <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink</span>(<span class="ruby-string">&#39;t,txt&#39;</span>, <span class="ruby-string">&#39;filelink&#39;</span>) <span class="ruby-comment"># =&gt; 0</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-string">&#39;filelink&#39;</span>)       <span class="ruby-comment"># =&gt; false</span>
</pre>

<p>Argument <code>path</code> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="directory-3F-source">
            <pre>VALUE
rb_file_directory_p(VALUE obj, VALUE fname)
{
#ifndef S_ISDIR
#   define S_ISDIR(m) (((m) &amp; S_IFMT) == S_IFDIR)
#endif

    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    if (S_ISDIR(st.st_mode)) return Qtrue;
    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-empty-3F" class="method-detail method-alias">
                            <div class="method-heading">
                              <span class="method-name">empty?</span><span
                                class="method-args">(p1)</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file exists and has a zero size.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                            </div>


                            <div class="aliases">
                              Alias for: <a href="FileTest.html#method-i-zero-3F">zero?</a>
                            </div>
                          </div>

                  <div id="method-i-executable-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          executable?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file is executable by the effective user and group id of this process. See eaccess(3).</p>

<p>Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in .bat, .cmd, .com, or .exe.</p>

<p>Note that some OS-level security features may cause this to return true even though the file is not executable by the effective user/group.</p>

                              <div class="method-source-code" id="executable-3F-source">
            <pre>static VALUE
rb_file_executable_p(VALUE obj, VALUE fname)
{
    return RBOOL(rb_eaccess(fname, X_OK) &gt;= 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-executable_real-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          executable_real?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file is executable by the real user and group id of this process. See access(3).</p>

<p>Windows does not support execute permissions separately from read permissions. On Windows, a file is only considered executable if it ends in .bat, .cmd, .com, or .exe.</p>

<p>Note that some OS-level security features may cause this to return true even though the file is not executable by the real user/group.</p>

                              <div class="method-source-code" id="executable_real-3F-source">
            <pre>static VALUE
rb_file_executable_real_p(VALUE obj, VALUE fname)
{
    return RBOOL(rb_access(fname, X_OK) &gt;= 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-exist-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          exist?(file_name)    &rarr;  true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Return <code>true</code> if the named file exists.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

<p>“file exists” means that stat() or fstat() system call is successful.</p>

                              <div class="method-source-code" id="exist-3F-source">
            <pre>static VALUE
rb_file_exist_p(VALUE obj, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    return Qtrue;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-file-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          file?(file) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named <code>file</code> exists and is a regular file.</p>

<p><code>file</code> can be an <a href="IO.html"><code>IO</code></a> object.</p>

<p>If the <code>file</code> argument is a symbolic link, it will resolve the symbolic link and use the file referenced by the link.</p>

                              <div class="method-source-code" id="file-3F-source">
            <pre>static VALUE
rb_file_file_p(VALUE obj, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    return RBOOL(S_ISREG(st.st_mode));
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-grpowned-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          grpowned?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file exists and the effective group id of the calling process is the owner of the file. Returns <code>false</code> on Windows.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="grpowned-3F-source">
            <pre>static VALUE
rb_file_grpowned_p(VALUE obj, VALUE fname)
{
#ifndef _WIN32
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    if (rb_group_member(st.st_gid)) return Qtrue;
#endif
    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-identical-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          identical?(file_1, file_2)   &rarr;  true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named files are identical.</p>

<p><em>file_1</em> and <em>file_2</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

<pre class="ruby"><span class="ruby-identifier">open</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;w&quot;</span>) {}
<span class="ruby-identifier">p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">identical?</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;a&quot;</span>)      <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-identifier">p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">identical?</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;./a&quot;</span>)    <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">link</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;b&quot;</span>)
<span class="ruby-identifier">p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">identical?</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;b&quot;</span>)      <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;c&quot;</span>)
<span class="ruby-identifier">p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">identical?</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;c&quot;</span>)      <span class="ruby-comment">#=&gt; true</span>
<span class="ruby-identifier">open</span>(<span class="ruby-string">&quot;d&quot;</span>, <span class="ruby-string">&quot;w&quot;</span>) {}
<span class="ruby-identifier">p</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">identical?</span>(<span class="ruby-string">&quot;a&quot;</span>, <span class="ruby-string">&quot;d&quot;</span>)      <span class="ruby-comment">#=&gt; false</span>
</pre>

                              <div class="method-source-code" id="identical-3F-source">
            <pre>static VALUE
rb_file_identical_p(VALUE obj, VALUE fname1, VALUE fname2)
{
#ifndef _WIN32
    struct stat st1, st2;

    if (rb_stat(fname1, &amp;st1) &lt; 0) return Qfalse;
    if (rb_stat(fname2, &amp;st2) &lt; 0) return Qfalse;
    if (st1.st_dev != st2.st_dev) return Qfalse;
    if (st1.st_ino != st2.st_ino) return Qfalse;
    return Qtrue;
#else
    extern VALUE rb_w32_file_identical_p(VALUE, VALUE);
    return rb_w32_file_identical_p(fname1, fname2);
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-owned-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          owned?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file exists and the effective used id of the calling process is the owner of the file.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="owned-3F-source">
            <pre>static VALUE
rb_file_owned_p(VALUE obj, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    return RBOOL(st.st_uid == geteuid());
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-pipe-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          pipe?(filepath) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>filepath</code> points to a pipe, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-constant">File</span>.<span class="ruby-identifier">mkfifo</span>(<span class="ruby-string">&#39;tmp/fifo&#39;</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">pipe?</span>(<span class="ruby-string">&#39;tmp/fifo&#39;</span>) <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">pipe?</span>(<span class="ruby-string">&#39;t.txt&#39;</span>)    <span class="ruby-comment"># =&gt; false</span>
</pre>

                              <div class="method-source-code" id="pipe-3F-source">
            <pre>static VALUE
rb_file_pipe_p(VALUE obj, VALUE fname)
{
#ifdef S_IFIFO
#  ifndef S_ISFIFO
#    define S_ISFIFO(m) (((m) &amp; S_IFMT) == S_IFIFO)
#  endif

    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    if (S_ISFIFO(st.st_mode)) return Qtrue;

#endif
    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-readable-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          readable?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file is readable by the effective user and group id of this process. See eaccess(3).</p>

<p>Note that some OS-level security features may cause this to return true even though the file is not readable by the effective user/group.</p>

                              <div class="method-source-code" id="readable-3F-source">
            <pre>static VALUE
rb_file_readable_p(VALUE obj, VALUE fname)
{
    return RBOOL(rb_eaccess(fname, R_OK) &gt;= 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-readable_real-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          readable_real?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file is readable by the real user and group id of this process. See access(3).</p>

<p>Note that some OS-level security features may cause this to return true even though the file is not readable by the real user/group.</p>

                              <div class="method-source-code" id="readable_real-3F-source">
            <pre>static VALUE
rb_file_readable_real_p(VALUE obj, VALUE fname)
{
    return RBOOL(rb_access(fname, R_OK) &gt;= 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-setgid-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          setgid?(file_name)   &rarr;  true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file has the setgid bit set.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="setgid-3F-source">
            <pre>static VALUE
rb_file_sgid_p(VALUE obj, VALUE fname)
{
#ifdef S_ISGID
    return check3rdbyte(fname, S_ISGID);
#else
    return Qfalse;
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-setuid-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          setuid?(file_name)   &rarr;  true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file has the setuid bit set.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="setuid-3F-source">
            <pre>static VALUE
rb_file_suid_p(VALUE obj, VALUE fname)
{
#ifdef S_ISUID
    return check3rdbyte(fname, S_ISUID);
#else
    return Qfalse;
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-size" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          size(file_name)   &rarr; integer
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns the size of <code>file_name</code>.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="size-source">
            <pre>static VALUE
rb_file_s_size(VALUE klass, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) {
        int e = errno;
        FilePathValue(fname);
        rb_syserr_fail_path(e, fname);
    }
    return OFFT2NUM(st.st_size);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-size-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          size?(file_name)   &rarr; Integer or nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>nil</code> if <code>file_name</code> doesn’t exist or has zero size, the size of the file otherwise.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="size-3F-source">
            <pre>static VALUE
rb_file_size_p(VALUE obj, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qnil;
    if (st.st_size == 0) return Qnil;
    return OFFT2NUM(st.st_size);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-socket-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          socket?(filepath)   &rarr;  true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>filepath</code> points to a socket, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">&#39;socket&#39;</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">socket?</span>(<span class="ruby-constant">Socket</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">:INET</span>, <span class="ruby-value">:STREAM</span>)) <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">socket?</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">new</span>(<span class="ruby-string">&#39;t.txt&#39;</span>))          <span class="ruby-comment"># =&gt; false</span>
</pre>

                              <div class="method-source-code" id="socket-3F-source">
            <pre>static VALUE
rb_file_socket_p(VALUE obj, VALUE fname)
{
#ifndef S_ISSOCK
#  ifdef _S_ISSOCK
#    define S_ISSOCK(m) _S_ISSOCK(m)
#  else
#    ifdef _S_IFSOCK
#      define S_ISSOCK(m) (((m) &amp; S_IFMT) == _S_IFSOCK)
#    else
#      ifdef S_IFSOCK
#        define S_ISSOCK(m) (((m) &amp; S_IFMT) == S_IFSOCK)
#      endif
#    endif
#  endif
#endif

#ifdef S_ISSOCK
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    if (S_ISSOCK(st.st_mode)) return Qtrue;
#endif

    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-sticky-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          sticky?(file_name)   &rarr;  true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file has the sticky bit set.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="sticky-3F-source">
            <pre>static VALUE
rb_file_sticky_p(VALUE obj, VALUE fname)
{
#ifdef S_ISVTX
    return check3rdbyte(fname, S_ISVTX);
#else
    return Qfalse;
#endif
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-symlink-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          symlink?(filepath) &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if <code>filepath</code> points to a symbolic link, <code>false</code> otherwise:</p>

<pre class="ruby"><span class="ruby-identifier">symlink</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink</span>(<span class="ruby-string">&#39;t.txt&#39;</span>, <span class="ruby-string">&#39;symlink&#39;</span>)
<span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-string">&#39;symlink&#39;</span>) <span class="ruby-comment"># =&gt; true</span>
<span class="ruby-constant">File</span>.<span class="ruby-identifier">symlink?</span>(<span class="ruby-string">&#39;t.txt&#39;</span>)   <span class="ruby-comment"># =&gt; false</span>
</pre>

                              <div class="method-source-code" id="symlink-3F-source">
            <pre>static VALUE
rb_file_symlink_p(VALUE obj, VALUE fname)
{
#ifndef S_ISLNK
#  ifdef _S_ISLNK
#    define S_ISLNK(m) _S_ISLNK(m)
#  else
#    ifdef _S_IFLNK
#      define S_ISLNK(m) (((m) &amp; S_IFMT) == _S_IFLNK)
#    else
#      ifdef S_IFLNK
#        define S_ISLNK(m) (((m) &amp; S_IFMT) == S_IFLNK)
#      endif
#    endif
#  endif
#endif

#ifdef S_ISLNK
    struct stat st;

    FilePathValue(fname);
    fname = rb_str_encode_ospath(fname);
    if (lstat_without_gvl(StringValueCStr(fname), &amp;st) &lt; 0) return Qfalse;
    if (S_ISLNK(st.st_mode)) return Qtrue;
#endif

    return Qfalse;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-world_readable-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          world_readable?(file_name)   &rarr; integer or nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>If <em>file_name</em> is readable by others, returns an integer representing the file permission bits of <em>file_name</em>. Returns <code>nil</code> otherwise. The meaning of the bits is platform dependent; on Unix systems, see <code>stat(2)</code>.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

<pre class="ruby"><span class="ruby-constant">File</span>.<span class="ruby-identifier">world_readable?</span>(<span class="ruby-string">&quot;/etc/passwd&quot;</span>)           <span class="ruby-comment">#=&gt; 420</span>
<span class="ruby-identifier">m</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">world_readable?</span>(<span class="ruby-string">&quot;/etc/passwd&quot;</span>)
<span class="ruby-identifier">sprintf</span>(<span class="ruby-string">&quot;%o&quot;</span>, <span class="ruby-identifier">m</span>)                              <span class="ruby-comment">#=&gt; &quot;644&quot;</span>
</pre>

                              <div class="method-source-code" id="world_readable-3F-source">
            <pre>static VALUE
rb_file_world_readable_p(VALUE obj, VALUE fname)
{
#ifdef S_IROTH
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qnil;
    if ((st.st_mode &amp; (S_IROTH)) == S_IROTH) {
        return UINT2NUM(st.st_mode &amp; (S_IRUGO|S_IWUGO|S_IXUGO));
    }
#endif
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-world_writable-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          world_writable?(file_name)   &rarr; integer or nil
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>If <em>file_name</em> is writable by others, returns an integer representing the file permission bits of <em>file_name</em>. Returns <code>nil</code> otherwise. The meaning of the bits is platform dependent; on Unix systems, see <code>stat(2)</code>.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

<pre class="ruby"><span class="ruby-constant">File</span>.<span class="ruby-identifier">world_writable?</span>(<span class="ruby-string">&quot;/tmp&quot;</span>)                  <span class="ruby-comment">#=&gt; 511</span>
<span class="ruby-identifier">m</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">world_writable?</span>(<span class="ruby-string">&quot;/tmp&quot;</span>)
<span class="ruby-identifier">sprintf</span>(<span class="ruby-string">&quot;%o&quot;</span>, <span class="ruby-identifier">m</span>)                              <span class="ruby-comment">#=&gt; &quot;777&quot;</span>
</pre>

                              <div class="method-source-code" id="world_writable-3F-source">
            <pre>static VALUE
rb_file_world_writable_p(VALUE obj, VALUE fname)
{
#ifdef S_IWOTH
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qnil;
    if ((st.st_mode &amp; (S_IWOTH)) == S_IWOTH) {
        return UINT2NUM(st.st_mode &amp; (S_IRUGO|S_IWUGO|S_IXUGO));
    }
#endif
    return Qnil;
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-writable-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          writable?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file is writable by the effective user and group id of this process. See eaccess(3).</p>

<p>Note that some OS-level security features may cause this to return true even though the file is not writable by the effective user/group.</p>

                              <div class="method-source-code" id="writable-3F-source">
            <pre>static VALUE
rb_file_writable_p(VALUE obj, VALUE fname)
{
    return RBOOL(rb_eaccess(fname, W_OK) &gt;= 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-writable_real-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          writable_real?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file is writable by the real user and group id of this process. See access(3).</p>

<p>Note that some OS-level security features may cause this to return true even though the file is not writable by the real user/group.</p>

                              <div class="method-source-code" id="writable_real-3F-source">
            <pre>static VALUE
rb_file_writable_real_p(VALUE obj, VALUE fname)
{
    return RBOOL(rb_access(fname, W_OK) &gt;= 0);
}</pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-zero-3F" class="method-detail ">
                      <div class="method-heading">
                        <span class="method-callseq">
                          zero?(file_name)   &rarr; true or false
                              </span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Returns <code>true</code> if the named file exists and has a zero size.</p>

<p><em>file_name</em> can be an <a href="IO.html"><code>IO</code></a> object.</p>

                              <div class="method-source-code" id="zero-3F-source">
            <pre>static VALUE
rb_file_zero_p(VALUE obj, VALUE fname)
{
    struct stat st;

    if (rb_stat(fname, &amp;st) &lt; 0) return Qfalse;
    return RBOOL(st.st_size == 0);
}</pre>
                              </div>
                            </div>

                            <div class="aliases">
                              Also aliased as: <a href="FileTest.html#method-i-empty-3F">empty?</a>
                            </div>

                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

